package auctionsimulation.statistics;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.BufferedOutputStream;

public final class Statistics {
	public static int startedAuctions = 0;
	public static int startedReverseEnglishAuctions = 0;
	public static int startedDutchAuctions = 0;
	public static int startedDoubleAuctions = 0;

	public static int matchedAuctions = 0;
	public static int matchedReverseEnglishAuctions = 0;
	public static int matchedDutchAuctions = 0;
	public static int matchedDoubleAuctions = 0;

	public static int successfullAuctions = 0;
	public static int successfullReverseEnglishAuctions = 0;
	public static int successfullDutchAuctions = 0;
	public static int successfullDoubleAuctions = 0;
	
	public static int unsuccessfullAuctions = 0;
	public static int unsuccessfullReverseEnglishAuctions = 0;
	public static int unsuccessfullDutchAuctions = 0;
	public static int unsuccessfullDoubleAuctions = 0;

	private Statistics() {

	}
	
	public static void print() {
		PrintStream out = null;
		try {
			out = new PrintStream(new BufferedOutputStream(new FileOutputStream("file.txt")), true);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		out.println("STATISTICS:");
		out.println("Started auctions: " + startedAuctions);
		out.println("Started reverse-english auctions: " + startedReverseEnglishAuctions);
		out.println("Started dutch auctions: " +startedDutchAuctions);
		out.println("Started double auctions: " + startedDoubleAuctions);
		out.println("=======================================");
		out.println("Matched auctions: " + matchedAuctions);
		out.println("Matched reverse-english auctions: " + matchedReverseEnglishAuctions);
		out.println("Matched dutch auctions: " + matchedDutchAuctions);
		out.println("Matched double auctions: " + matchedDoubleAuctions);
		out.println("=======================================");
		out.println("Successfull auctions: " + successfullAuctions);
		out.println("Successfull reverse-english auctions: " + successfullReverseEnglishAuctions);
		out.println("Successfull dutch auctions: " + successfullDutchAuctions);
		out.println("Successfull double auctions:" + successfullDoubleAuctions);
		out.println("=======================================");
		out.println("Unsuccessfull auctions: " + unsuccessfullAuctions);
		out.println("Unsuccessfull reverse-english auctions: " + unsuccessfullReverseEnglishAuctions);
		out.println("Unsuccessfull dutch auctions: " + unsuccessfullDutchAuctions);
		out.println("Unsuccessfull double auctions:" + unsuccessfullDoubleAuctions);
	}
}
